//
//  main.m
//  SqliteManagerDemo
//
//  Created by US bike on 2017/9/4.
//  Copyright © 2017年 US bike. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "AppDelegate.h"

#import <GCDWebServer/GCDWebServer-umbrella.h>


/*
#import <XLFacility/XLStandardLogger.h>
#import <XLFacility/XLHTTPServerLogger.h>
#import <XLFacility/XLFacilityMacros.h>
 */

int main(int argc, char * argv[]) {
    @autoreleasepool {
    
        
        /*
        [XLSharedFacility removeAllLoggers];
        
        

        
        XLHTTPServerLogger *httpLogger = [[XLHTTPServerLogger alloc] init];
        httpLogger.minLogLevel = 2;
        [XLSharedFacility addLogger:httpLogger];
         */
        
        
        //cocoaLumberjack
        //[DDLog addLogger:[DDTTYLogger sharedInstance]]; // TTY = Xcode console
        //[DDLog addLogger:[DDASLLogger sharedInstance]]; // ASL = Apple System Logs
        
        DDFileLogger *fileLogger = [[DDFileLogger alloc] init]; // File Logger
        fileLogger.rollingFrequency = 60 * 60 * 24; // 24 hour rolling
        fileLogger.logFileManager.maximumNumberOfLogFiles = 7;
        [DDLog addLogger:fileLogger];
        
        NSString * logsDir = [[fileLogger logFileManager] logsDirectory];
        
        
        [GCDWebDAVServer setLogLevel:2];
        //NSString *serverPath = [[[[DDFileLogger alloc] init] logFileManager] logsDirectory];
        
        NSString *serverPath = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)[0];
        
        GCDWebDAVServer *advServer = [[GCDWebDAVServer alloc] initWithUploadDirectory:serverPath];
        [advServer start];
        
        
        NSFileManager *mamager = [NSFileManager defaultManager];
        NSArray<NSString *> *pathArray = [mamager subpathsAtPath:logsDir];
        
        for (NSString *temp in pathArray) {
            NSLog(@"path = : %@", temp);
        }
        
        return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
    }
}
